{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Smile in Kotlin"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Smile is a supported library of Kotlin kernel. When a library is included with %use keyword, default imports are available implicitly."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "// %use smile\n",
    "\n",
    "// Or test the newer versions through @file:DependsOn and import library explicitly.\n",
    "@file:DependsOn(\"com.github.haifengl:smile-kotlin:4.0.0\")\n",
    "@file:DependsOn(\"com.github.haifengl:smile-core:4.0.0\")\n",
    "\n",
    "import org.apache.commons.csv.CSVFormat\n",
    "import smile.*\n",
    "import smile.data.formula.Formula\n",
    "import smile.io.Read\n",
    "import smile.association.*\n",
    "import smile.classification.*\n",
    "import smile.clustering.*\n",
    "import smile.manifold.*\n",
    "import smile.nlp.*\n",
    "import smile.wavelet.*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "val iris = Read.arff(\"../data/weka/iris.arff\")\n",
    "println(iris)\n",
    "iris.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "val rf = RandomForest.fit(Formula.lhs(\"class\"), iris)\n",
    "println(\"OOB error = ${rf.metrics()}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "pygments_lexer": "kotlin",
   "version": "1.4.0-dev-7568"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
